package com.hg.controller;

import com.hg.common.HttpStatus;
import com.hg.common.R;
import com.hg.pojo.dto.AddOrdersVo;
import com.hg.service.HgMallOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/customer")
public class CustomerOrderController {

    @Autowired
    private HgMallOrderService hgMallOrderService;

    @PostMapping("/addOrder")
    public R add(@RequestBody AddOrdersVo ordersVo) {
       int addOrder= hgMallOrderService.addOrder(ordersVo);
       if (addOrder==0){
           return R.error(HttpStatus.ORDER_ERROR,"添加订单错误");
       }
       return R.success(HttpStatus.ORDER_SUCCESS,"添加订单成功");
    }
}
